package com.music.controller;


import com.music.dao.CmUserDaoMapper;
import com.music.entity.CmUser;
import com.music.excel.WriteXLS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ExcelController {
    @Autowired
    private WriteXLS writeXLS;
    @Autowired
    private CmUserDaoMapper cmUserDaoMapper;
    @RequestMapping(value = "/writeExcel",method = RequestMethod.GET)
    public String WriteExcel(){
        List<CmUser> all = cmUserDaoMapper.findAll();
        writeXLS.exportExcel (all);
        return "成功";
    }
}